package wodegua.d12_math;

public class MathTest {
    public static void main(String[] args) {

        //绝对值
        System.out.println(Math.abs(-12)); //12
        System.out.println(Math.abs(12)); //12

        //向上取整
        System.out.println(Math.ceil(4.0000001)); //5.0
        System.out.println(Math.ceil(4.0000000)); //4.0

        //向下取整
        System.out.println(Math.floor(5.999999)); //5.0
        System.out.println(Math.floor(5.000001)); //5.0

        //四舍五入
        System.out.println(Math.round(4.2)); //4
        System.out.println(Math.round(4.5)); //5
    }
}
